#ifndef __KEY_TASK_H
#define __KEY_TASK_H

#include "stm32f4xx.h"

typedef enum 
{
    KEY_USER_KEY = 0,
    KEY_TYPE_MAX
}key_type_t;

typedef enum 
{
    KEY_NULL = 0,
    KEY_PRESS,
    KEY_RELEASE
}key_state_t;

typedef enum 
{
    KEY_NO_PRESS = 0,
    KEY_SHORT_PRESS,
    KEY_LONG_PRESS,
    KEY_DOUBLE_PRESS
}key_result_t;

typedef struct key_event
{
    key_type_t key_type;
    uint32_t trigger_tick;
    key_state_t state;
}key_event_t;


typedef struct KeyInterface 
{   
    void (*pfinit)(void);
    void (*pftask)(void);
    key_result_t* (*pfget_result)(void);
}KeyInterface_t;

extern KeyInterface_t key_interface;


void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin);


#endif /* __KEY_TASK_H */